import request from '../utils/request';

/**
 用户区
 */
//登录注册接口
export const login =  (params) => request.get(`/login?password=${params.password}&phone=${params.phone}`, params)
//查看所有用户
export const queryAllUser = (params)=> request.get(`queryAllUser`,params)
//修改用户信息
export const updateUserByAdmin = (data)=> request.post(`updateUserByAdmin`,data)


/**
 活动区
 */
//管理审核活动，查看所有的活动
export const queryAllActiveAdmin = (params)=> request.get(`queryAllActiveAdmin`,params)
//审核活动
export const auditActive = (params)=> request.post(`auditActive?activeId=${params.activeId}&args=${params.args}`,params)
//查看单个活动
export const queryDetailActive = (params)=> request.get(`queryDetailActive?id=${params}`,params)
/**
 订单区
 */
export const queryAllOrder = (params)=> request.get(`queryAllOrder`,params)
//根据地址ID查找详细地址
export const queryAddressById = (params)=> request.get(`queryAddressById?addressId=${params}`,params)
//更新订单状态
export const updateOrder = (params)=> request.put(`updateOrder?id=${params.id}&orderType=${params.orderType}`,params)
//根据订单号查看订单项
export const queryOrderItemMany = (params)=> request.get(`queryOrderItemMany?orderNum=${params}`,params)
//根据订单ID查找订单事项
export const queryDetail = (params)=> request.get(`queryDetail?orderId=${params}`,params)
// 查看时间币流水
export const queryAllCoin = (params)=> request.post(`queryAllCoin`,params)

/***
 商品区
 */
/*
查看商品根据ID
 */
export  const queryGoodsById = (params) => request.get(`queryGoodsById?id=${params}`,params)
/*
分页获取商品信息
 */
export  const queryGoodsPage = (data) => request.get(`queryGoodsPageByAdmin?page=${data.page}&size=${data.size}`,data)
/*
新增商品
 */
export  const insertGoods = (data) => request.post(`insertGoods`,data)
/*
更新商品数据
 */
export  const updateGoods = (data) => request.put(`updateGoods`,data)

/**
 * 供应商信息
 */
// querySupplier 查看所有的供应商
export const querySupplier = (params)=> request.get(`querySupplier`,params)
// querySupplierDetail 根据id查看某个供应商信息
export  const querySupplierDetail = (params) => request.get(`querySupplierDetail?id=${params}`,params)
// insertSupplier 新增一个供应商
export  const insertSupplier = (data) => request.post(`insertSupplier`,data)
// updateSupplier 更新某个供应商信息
export  const updateSupplier = (data) => request.put(`updateSupplier`,data)

/**
 * 非遗活动接口
 */

// 查看所有非遗活动
export const queryAllNormalStudy = (params)=> request.post(`queryAllNormalStudy`,params)
// 第一次审批活动-通过
export  const auditNormalStudyAllow = (params) => request.put(`auditNormalStudyAllow?activeId=${params}`,params)
// 第一次审批活动-驳回
export  const auditNormalStudyRefuse = (params) => request.put(`auditNormalStudyRefuse?activeId=${params.activeId}&money=${params.money}&reason=${params.reason}&userId=${params.userId}`,params)


/**
 * 身份认证用于审核用户信息
 */
//查看所有待审核用户信息
export const queryAuditUser = (params)=> request.get(`queryAuditUser`,params)
//进行用户信息的审核
export  const auditUser = (params) => request.post(`auditUser?isAudit=${params.isAudit}&userId=${params.userId}`,params)
